package org.fao.geonet.services.param.branch;

import org.jdom.*;

import jeeves.constants.*;
import jeeves.interfaces.*;
import jeeves.resources.dbms.*;
import jeeves.server.*;
import jeeves.server.context.*;
import jeeves.utils.*;

import org.fao.geonet.constants.*;

//=============================================================================

/** Removes a user from the system. It removes the relationship to a group too
*/

public class RemoveDetail implements Service
{
	//--------------------------------------------------------------------------
	//---
	//--- Init
	//---
	//--------------------------------------------------------------------------

	public void init(String appPath, ServiceConfig params) throws Exception {}

	//--------------------------------------------------------------------------
	//---
	//--- Service
	//---
	//--------------------------------------------------------------------------

	public Element exec(Element params, ServiceContext context) throws Exception
	{
		String id = Util.getParam(params, Params.ID);
		Dbms dbms = (Dbms) context.getResourceManager().open (Geonet.Res.MAIN_DB);
		dbms.execute ("DELETE FROM organization_branch_detail WHERE id=" + id);
		return new Element(Jeeves.Elem.RESPONSE);
	}
}

//=============================================================================

